﻿#ifndef B3HSMSEQP_H
#define B3HSMSEQP_H
#include "HsmsEQP.h"
#include <QDateTime>

class B3HsmsEQP : public HsmsEQP
{
    Q_OBJECT
public:
    B3HsmsEQP(QObject *parent = nullptr);
    void setEQPID(QString EQPID) {m_EQPID = EQPID;}
    void setUNITID(QString UNITID) {m_UNITID = UNITID;}
    void setMODULEID(QString MODULEID) {m_MODULEID = MODULEID;}
    QString getPanelInfo(QString itemName);

public slots:
    void sendS6F11(); //ControlStateChangeOnLineLocal
    void sendS6F209(QString OPERATORID, QString PASSWORD); //OperatorAuthorityRequest
    void sendS6F207(QString PNLID); //PanelInfoRequest
    void sendS6F3(QString PNLID, QVector< QPair<QString, QString> > data);
signals:
    void loginStatus(bool ok);
    void dateTimeReplyReceived(QDateTime dt);
    /**
     * @brief onlineLocal
     * @param ok   true 表示成功切换到ONLINE 模式
     *             false 表示失败
     *             TODO：这里应该在加入第三种状态，命令超时
     */
    void onlineLocal(bool ok);
    void panelInfoUpdated(bool ok);
private slots:
    void privateDataMessage(const HSMSMessages &message);
private:
    SECS2Item buildS6F3Item(QString PNLID, QString DVNAME, QVector< QPair<QString, QString> > data);
    void onReceiveS2F207(const HSMSMessages &message); //PANELINFOSET
    void onReceiveS6F12(const HSMSMessages &message); //EventReportAcknowledge
    void onReceiveS2F18(const HSMSMessages &message); //Date and time data
    void onReceiveS1F5(const HSMSMessages &message); //Formatted status request
    void onReceiveS6F210(const HSMSMessages &message); //OperatorAuthorityRequestReply
    void onReceiveS6F4(const HSMSMessages &message);//DiscreteVariableDataAcknowledge
    void onReceiveS2F209(const HSMSMessages &message);
    void onReceiveS6F208(const HSMSMessages &message); //PanelInfoRequestReply
    void onReceiveS10F5(const HSMSMessages &message);//Terminal display, multi-block

    QMap<QString, QString> m_PANELINFOSET;

    QString m_EQPID;
    QString m_UNITID;
    QString m_MODULEID;
    QString m_DVNAME;
    QString m_CRST;
    QString m_EQST;
};

#endif // B3HSMSEQP_H
